/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.colegiatura.be;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author ADMINISTRADOR
 */
@Entity
@Table(name = "col_especialista")
@NamedQueries({@NamedQuery(name = "Especialista.findAll", query = "SELECT e FROM Especialista e"), @NamedQuery(name = "Especialista.findBySpeCodigo", query = "SELECT e FROM Especialista e WHERE e.speCodigo = :speCodigo"), @NamedQuery(name = "Especialista.findBySpeDescripcion", query = "SELECT e FROM Especialista e WHERE e.speDescripcion = :speDescripcion")})
public class Especialista implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "spe_codigo")
    private Long speCodigo;
    @Basic(optional = false)
    @Column(name = "spe_descripcion")
    private String speDescripcion;

    @JoinColumn(name = "col_codigo", referencedColumnName = "col_codigo")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Colegiado colCodigo;

    public Especialista() {
    }

    public Especialista(Long speCodigo) {
        this.speCodigo = speCodigo;
    }

    public Especialista(Long speCodigo, String speDescripcion) {
        this.speCodigo = speCodigo;
        this.speDescripcion = speDescripcion;
    }

    public Long getSpeCodigo() {
        return speCodigo;
    }

    public void setSpeCodigo(Long speCodigo) {
        this.speCodigo = speCodigo;
    }

    public String getSpeDescripcion() {
        return speDescripcion;
    }

    public void setSpeDescripcion(String speDescripcion) {
        this.speDescripcion = speDescripcion;
    }

    public Colegiado getColCodigo() {
        return colCodigo;
    }

    public void setColCodigo(Colegiado colCodigo) {
        this.colCodigo = colCodigo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (speCodigo != null ? speCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Especialista)) {
            return false;
        }
        Especialista other = (Especialista) object;
        if ((this.speCodigo == null && other.speCodigo != null) || (this.speCodigo != null && !this.speCodigo.equals(other.speCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.cip.esymons.colegiatura.be.Especialista[speCodigo=" + speCodigo + "]";
    }

}
